package cn.edu.scau.cmi.zengGuanSheng.composite.consistent;

import javafx.fxml.FXML;

import javafx.scene.control.Button;
import cn.edu.scau.cmi.zengGuanSheng.comprehensiveExperiment.MainClient;
import javafx.event.ActionEvent;

import javafx.scene.control.TextArea;

public class ConsistentController {
	@FXML
	private Button btn_show;
	@FXML
	private TextArea textArea;
	@FXML
	private Button btn_return;

	// Event Listener on Button[#btn_show].onAction
	@FXML
	public void eventShow(ActionEvent event) {
		// TODO Autogenerated
		textArea.setText(null);
		ConsistentComponent root = new ConsistentComposite("明教(组织)");
		root.addChild(new ConsistentLeaf("张无忌(个人)属于明教(组织)中人"));
		root.addChild(new ConsistentLeaf("殷天正(个人)属于明教(组织)中人"));
		
		ConsistentComponent branchX = new ConsistentComposite("四大法王(组织)隶属于明教(组织)");
		ConsistentComponent branchY = new ConsistentComposite("五散人(组织)隶属于明教(组织)");
		root.addChild(branchX);
		root.addChild(branchY);
		
		branchX.addChild(new ConsistentLeaf("殷天正(个人)属于四大法王(组织)中人"));
		
		ConsistentComponent branchZ = new ConsistentComposite("五行旗(组织)隶属于五散人(组织)中");
		branchY.addChild(branchZ);
		
		branchY.addChild(new ConsistentLeaf("周颠(个人)属于五散人(组织)中人"));
		
		branchZ.addChild(new ConsistentLeaf("黄大哥(个人)属于五行旗(组织)中人"));
		//显示组织结构
		root.display1(1,textArea);
	}
	// Event Listener on Button[#btn_return].onAction
	@FXML
	public void eventReturn(ActionEvent event) {
		// TODO Autogenerated
		MainClient main = new MainClient();
		main.start(ConsistentClient1.primaryStage);
	}
}
